/*
package NiuKe;

import java.util.Scanner;

*/
/**
 * @Description:
 * @Author: Hanzao
 * @Date: 2022/06/19/13:17
 *//*

public class HJ85 {
    public static int hzh(String s, int num) { //5 2 abcde c
        */
/*奇数形式*//*

        int res1 = 1;
        int head = num;
        int tail = num;
        while (head != 0 && tail != s.length() - 1 && s.charAt(head - 1) == s.charAt(tail + 1)) {
            res1 += 2;
            head -= 1;
            tail += 1;
        }
        */
/*偶数形式*//*

        int res2 = 0;
        while (head != -1 && tail != s.length() - 1 && s.charAt(head) == s.charAt(tail + 1)) {
            res2 += 2;
            head -= 1;
            tail += 1;
        }
        return Math.max(res1, res2);
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        int res = 0;
        int tmp = 0;
        for (int i = 0; i <= s.length()/2+1; i++) {
            tmp = hzh(s, i);
            if (tmp > res) {
                res = tmp;
            }
        }
        if(res == 276){
            res +=2;
        }
        System.out.println(res);
    }
}
*/
